package com.china.produce.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

/**
 * @ClassName
 * @Author niujie
 * @Version
 * @Description
 * @CreateTime 2022/6/24
 */
@Service
public class TestService {

//    @Resource
//    private TestBeanService testBeanService;

    @Async
    public Future<String> test(String params)
    {
        try {
            System.out.println(params);

            TimeUnit.SECONDS.sleep(3);

        }catch (Exception exception) {

        }

        CompletableFuture<String> res = new CompletableFuture<>();

        res.complete(params);

        return res;
    }
}
